You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: enforce project scope for report creation and reassignment - #651
Project-restricted reviewers could create or move reports into projects they do not supervise. For new records, the shared setter does not run checkOldObject; for existing records, the callbacks only checked the stored project. Bulk report imports resolved project references without checking the caller’s project scope.
Check supplied target projects before creating or modifying reports or writing history. Check all resolved projects before a bulk save, rejecting an unauthorized mixed batch in full. Existing-record checks still require authority over the original project. Unrestricted reviewers (an empty supervision list) and personal owner permissions retain their existing behavior.
The covered staff endpoints are:
Advances: creation and approval-time project reassignment; bulk approved-advance imports.
Travel: creation and approval-time project reassignment, examiner detail edits, and bulk approved-travel imports.
Health care costs: examiner-created drafts, detail edits, and return-to-draft project reassignment. There is no corresponding report-level bulk import.
Expense and health care examiner creation produces IN_WORK drafts. Their reviewCompleted endpoints already reject reports in unsupervised projects; regression scenarios verify that existing protection.
Validation:
Unauthorized creation/reassignment and mixed imports were reproduced before the corresponding fixes.
14 focused HTTP regression scenarios cover the affected creation, reassignment, and bulk-import paths. They verify rejection without persisted changes and successful writes to a supervised project.
The regression coverage is consolidated into one 216-line file, removing repeated role, state, and reference-format combinations.
Complete backend suite: 333 tests passed, including the 14 new scenarios. Backend build, Biome 2.6.3, and git diff --check passed.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
Walkthrough
Advance, travel, expense-report, and health-care-cost controllers now check whether the requester supervises the specified project. Bulk operations reject the request if any resolved project fails that check. Individual operations reject unauthorized project assignments before proceeding. New API tests cover denied and permitted operations, project references supplied as IDs or objects, and persisted record and project state.
No merge-blocking issue was identified; the project authorization changes appear ready to merge after normal checks.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title describes real changes involving project-scoped report creation and reassignment. However, it omits the broader and primary scope of advance and travel approval authorization, including bulk…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title describes real changes involving project-scoped report creation and reassignment. However, it omits the broader and primary scope of advance and travel approval authorization, including bulk imports.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 8 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
david-loe
changed the title
fix: authorize approved advances against their target project
fix: enforce project authorization for advance and travel approvals
Oct 29, 2026
david-loe
changed the title
fix: enforce project authorization for advance and travel approvals
fix: enforce project scope for report creation and reassignment
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Project-restricted reviewers could create or move reports into projects they do not supervise. For new records, the shared setter does not run
checkOldObject; for existing records, the callbacks only checked the stored project. Bulk report imports resolved project references without checking the caller’s project scope.Check supplied target projects before creating or modifying reports or writing history. Check all resolved projects before a bulk save, rejecting an unauthorized mixed batch in full. Existing-record checks still require authority over the original project. Unrestricted reviewers (an empty supervision list) and personal owner permissions retain their existing behavior.
The covered staff endpoints are:
Expense and health care examiner creation produces
IN_WORKdrafts. TheirreviewCompletedendpoints already reject reports in unsupervised projects; regression scenarios verify that existing protection.Validation:
git diff --checkpassed.